<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组的扩展</title>
    <script>
        let cartArr = [
            {
                id:10001,
                price:20,
                num:6
            },
            {
                id:10002,
                price:10,
                num:3
            },
            {
                id:10003,
                price:30,
                num:2
            }

        ];

        //遍历整个数组，当条件满足时返回当前被遍历的对象
       let result = cartArr.find(ele=>ele.id===10003);

       console.log(result);

    </script>
</head>
<body>

</body>
</html>